package com.qf.controller;

import com.qf.entity.City;
import com.qf.entity.ResultData;
import com.qf.service.ICtiyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 对外的访问接口
 */
@RestController
@RequestMapping("/web")
public class WebController {

    @Autowired
    private ICtiyService ctiyService;

    /**
     * 获取城市列表
     * @return
     */
    @RequestMapping("/citylist")
    public ResultData<List<City>> cityList(){
        List<City> list = ctiyService.list();
        return new ResultData<List<City>>().setCode(ResultData.Code.CODE_SUCC).setData(list);
    }
}
